<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>匿名Slot</title>
    <style>
        template{
            display: none;
        }
    </style>
</head>
<body>
    <div id="app">
        <my-component></my-component>
        <my-component>
            <h5>Hello Vue.js</h5>
        </my-component>
    </div>
    <template id='myComponent'>
        <div>
            <p>Hello</p>
            <slot>如果没有分发内容，则显示slot中的内容</slot>
            <p>End</p>
        </div>
    </template>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    var app = new Vue({
        el: "#app",
        components: {
            "my-component": {
                template: "#myComponent"
            }
        }
    });
</script>
</html>